//
//  WtfkVC.swift
//  Auscultation
//
//  Created by 来 on 2020/12/7.
//

import UIKit

class WtfkVC: BaseVC {
    
    var scrollView: UIScrollView!
    
    var wtmc: LGFLoginImageTitleView!
    var yzcd: LGFLoginImageTitleView!
    var wtms: UITextView!
    var wtms_p: UILabel!
    var fj: LGFSelectImageCollectionView!

    override func viewDidLoad() {
        super.viewDidLoad()

        initUI()
    }
    

    @objc func queding(_ sender: UIButton) {
        if wtmc.textField.text!.lgf_IsBlank() {
            SVProgressHUD.showError("请填问题名称")
            return
        }
        if yzcd.lgf_Name == nil {
            SVProgressHUD.showError("请选择严重程度")
            return
        }
        if wtms.text!.lgf_IsBlank() {
            SVProgressHUD.showError("请填写问题内容")
            return
        }

        let paramet: [String: Any] = [
            "title": self.wtmc.textField.text ?? "",
            "level": self.yzcd.lgf_Name ?? "",
            "content": self.wtms.text ?? "",
            "photoPatch": self.fj.lgf_Name ?? "",
            "createdBy": EWEUser.lgf.realName ?? "",
            "createdTime": Date().lgf_TimeStampString(),
        ]
        EWERequest.lgf("feedback", paramet, .post, JSONEncoding.default) { (data) in
            SVProgressHUD.showSuccess("您的问题反馈成功！")
            self.navigationController?.popViewController(animated: true)
        } _: { (error) in
            SVProgressHUD.showError(error)
        }
    }
    
    @objc func quxiao(_ sender: UIButton) {
        self.navigationController?.popViewController(animated: true)
    }

}
